home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- #
- # Copyright Novell Inc. 1991
- # (C) Unpublished Copyright of Novell, Inc. All Rights Reserved.
- #
- # No part of this file may be duplicated, revised, translated, localized
- # or modified in any manner or compiled, linked or uploaded or
- # downloaded to or from any computer system without the prior written
- # consent of Novell, Inc.
- #
- # NetWare Unix Client
- # Author: Gary B. Tomlinson
- # Created: 7/9/91
- #
- # SCCS ID: 1.4
- # delta: 1/10/92 15:54:17
- #
- # MODULE:
- # The independentFilter - The NUC Client Network Printer NeXT2_0
- # lpd spooler independent filter program.
- # Component of the NUC PCLIENT Services.
- #
- # ABSTRACT:
- # The independentFilter shell script contains the NeXT platform centric
- # printjob() generic filter interface program, which services all
- # NetWare printers in behalf of printjob() in the lpd(8) spooler.
- # This shell script establishes a pipe which reads from the spooled
- # print file mapped onto STDIN, pushes the appropriate Printer Type
- # dependent filter program, and connects the pipe to the
- # printjob_nucps(1) NetWare printer driver back end. The printjob()
- # function linked into the lpd(8), PrintPanel(GUI) programs calls
- # this program to spool print files to NetWare QMS print queues.
- #
- # ARCHITECTURAL MODEL
- # The NUC Client Print Systems has been designed to plug into the
- # exsiting NeXT lpd(8) spooler complex as a dependent print system. It
- # also has been designed to be extensible for various printer type
- # support. NetWare supports a wide variety of printers, thus a
- # mechanism which allows printers types to be defined to the NUC, and
- # the associated filter programs for these printers to be plugged into
- # the NUC is necessary. This filter is a generic filter which sets up
- # the PIPE from lpd(8) to the NUC printer driver printjob_nucps(1), and
- # then pushes (calls) the appropriate dependent filter program into the
- # PIPE passing all the arguments given it by lpd(8). Thus any standard
- # BSD filter which reads STDIN and writes STDOUT (they all should) can
- # be plugged into the NUC and work without any modification except for
- # the naming conventions used by the NUC.
- #
- # The depdendent filter naming conventions used by the NUC are as
- # follows. This Shell Script is symbolically linked to the
- # /usr/netware/bin/PrinterFilters/{PrinterType}/{.cf,.df,.gf,.if,.nf,
- # .rf, .tf,.vf} hidden generic filters. The real filter for the
- # PrinterType is then placed in this directory under than name of cf,
- # df, gf, if, nf, rf, tf, or vf according to the type of filter it is.
- # The real depedent filter program inherits the STDIN and STDOUT
- # necessary to do its work, and is free to push any additional programs
- # into the PIPE that it needs to do its job. The generic .?? filter
- # supplied by the NUC will attempt to push the dependent real filter
- # into the PIPE, and if it can't will gracefully abort the print
- # request.
- #
- # NOTE:
- # The print system model implemented by Novell on NeXT platforms
- # follows the file system model for dependent file systems. The NetWare
- # NCP Printer Service Class is represented by the following dependent
- # shell commands:
- # independentFilter (This Shell Script)
- # PostScriptFilter (Novell Supplied Dependent Filter)
- # DefaultFilter (Novell Supplied Dependent Filter)
- # displayq_nucps (Related Program)
- # printjob_nucps (This Scripts PIPE Child Program)
- # rmjob_nucps (Related Program)
- #
- #
-
- #
- # BEGIN_MANUAL_ENTRY(independentFilter(1), \
- # ./man/shell/print/client/NeXT/independentFilter)
- # NAME
- # independentFilter, .cf, .df, .gf, .if, .nf, .rf, .tf, .vf
- # - Set up Spoolng PIPE of a NeXT print file to
- # NetWare QMS. Member of the NUC PCLIENT Suite.
- #
- # SYNOPSIS
- # ./PrinterFilters/{PrinterType}/.cf -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.df -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.gf -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.if [-c] -wChWidth -lChLength -iChIndent
- # [-f printFileName] -n userName -h hostName
- # [-R resolution] [-M] -p printerName accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.nf -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.rf -wChWidth -lChLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.tf -xPxwidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/{PrinterType}/.vf -xPxwidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # OPTIONS
- # accountingFileName - Name of accounting file.
- # -c - Pass control characers through. Those in
- # addition to CR, LF, FF, and HT. Used with
- # ASCII files.
- # -f printFileName - Name of NeXT file being printed.
- # -h hostName - Name of host print file originated on.
- # -iChIndent - Left margin indentation in characters. Used
- # with ASCII files.
- # -lChLength - Length of page in lines. Used with
- # ASCII files.
- # -n userName - Name of User who spooled the file.
- # -p printerName - Name of printer known by on NeXT work station.
- # -wChWidth - Width of page in characters. Used with
- # ASCII files.
- # -xPxWidth - Width of page in pixels. Used for Bit Maps.
- # -yPxLength - Length of page in pixels. Used for Bit Maps.
- # -M - Printer is to be manually fed.
- # -R resolution - Resolution in Dots Per Inch of print
- # print resolution desired.
- #
- # INPUT
- # None.
- #
- # OUTPUT
- # Successfull - Silently exits back to printjob() in parent lpd(8)
- # Failure - Abort message formatted and displayed on
- # STDOUT.
- #
- # DESCRIPTION
- # The independentFilter sets up the unspooling PIPE of a file being
- # scheduled for lpd[printjob.o] to a remote NetWare printer. It is
- # invoked by its filter name in printcap(5)/netinfo(5). This shell
- # script sets up the PIPE to its printjob_nucps(1) NetWare printer
- # driver with the appropriate depedent real filter for the PrinterType
- # pushed. All filtering is done on the NeXT work station prior to
- # spooling it over over the wire.
- #
- # Note:
- # All names are symbolically linked to the same shell script for
- # servicing. The called name indicates the filter setup
- # model to be used.
- #
- # FILES
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.cf
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.df
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.gf
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.if
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.nf
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.rf
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.tf
- # /usr/netware/bin/PrinterFilters/{PrinterType}/.vf
- #
- # SEE ALSO
- # NWcpsIntroduction(3), printjob_nucps(1)
- #
- # END_MANUAL_ENTRY
- #
-
- #
- # Default the Variables
- #
- fileName=""
- fileArgs=""
- printerName=""
- userName=""
- ChLength=""
- ChWidth=""
- BANNER=""
- # Parse the Name of the Filter
- ifProgramName=`basename $0`
-
- # Parse the Path of the Filter
- filterPathName=`echo $0 | sed -e 's/\/[^/]*$//'`
-
- # Parse the Printer Type
- printerType=`basename $filterPathName`
-
- PRINTJOB_NUCPS="/usr/netware/bin/printjob_nucps"
- DEFAULT_FILTER="/bin/cat"
- PS_COMMENT_FILTER=/NextLibrary/Services/PrintFilters.service/psprepare
-
- #
- # Now read in the .options file for printer customization.
- #
- # Note:
- # Banners are not processed on NeXT for now. NetWare configures them
- # on a per printer basis, thus NetWare administrators can print
- # them if they wish.
- # BANNER=-B if NetWare banners are to be printed.
- #
- #.options
-
- #
- # Parse the command line to shell script
- #
- argV=$@
- while [ $# != 0 ]
- do
- case "$1" in
-
- -c) # Pass Control Characters, Ignored!!
- ;;
-
- -f) # Name of print file
- fileArgs="$1 $2";
- fileName="$2";
- shift;
- ;;
-
- -h) # Host name of user who spooled, Ignored!!
- shift;
- ;;
-
- -i*) # Left margin indentation, Ignored!!
- ;;
-
- -l*) # Page Length in Character Lines
- ChLength=$1
- ;;
-
- -n) # User Name
- userName=$2;
- shift;
- ;;
-
- -p) # Local Printer Name
- printerName=$2;
- shift;
- ;;
-
- -w*) # Page Width in Characters
- ChWidth=$1;
- ;;
-
- -x*) # Page Width in Pixels, Ignored!!
- ;;
-
- -y*) # Page Length in Pixels, Ignored!!
- ;;
-
- -M) # Manual feed specified, Ignored!!
- ;;
-
- -R) # Printer Resolutin in DPI, Ignored!!
- shift;
- ;;
-
- *) # Accounting File, Ignored!!
- shift;
- ;;
-
- esac
-
- if [ $# != 0 ]
- then
- shift;
- fi
-
- done
-
- if [ -z "$printerName" ]
- then
- # On NeXT, aquire the Printer Name via the current directory, spool
- # directory names are the same as the printer name
- #
- spoolDirectory=`pwd`
- printerName=`basename $spoolDirectory`
- fi
-
- #
- # Decode the ifProgramName and set up the proper pipe
- #
- case $ifProgramName in
-
- .cf)
- #
- # They need a CIFPLOT filter
- #
- dependentFilter=$filterPathName/cf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: CIFPLOT filter for Printer Type $printerType not \c" >/dev/console
- echo "installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .df)
- #
- # They need a DVI TeX filter
- #
- dependentFilter=$filterPathName/df
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: DVI TeX filter for Printer Type $printerType not \c" >/dev/console
- echo "installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .gf)
- #
- # They need a PLOT graphic filter, use
- #
- dependentFilter=$filterPathName/gf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: PLOT filter for Printer Type $printerType not \c" >/dev/console
- echo "installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .if)
- #
- # They need a interface filter only
- #
- dependentFilter=$filterPathName/if
- if [ ! -x $dependentFilter ]
- then
- #
- # Use "cat" as the default filter, with implied -c for
- # control character stripping
- #
- dependentFilter=$DEFAULT_FILTER
- fi
- ;;
-
- .nf)
- #
- # They need a DITROFF phototypesetter filter
- #
- dependentFilter=$filterPathName/nf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: DITROFF filter for Printer Type $printerType not \c" >/dev/console
- echo "installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .rf)
- #
- # They need a FORTRAN Text filter
- #
- dependentFilter=$filterPathName/rf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: FORTRAN Text filter for Printer Type $printerType \c" >/dev/console
- echo "not installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .tf)
- #
- # They need a TROFF phototypesetter filter
- #
- dependentFilter=$filterPathName/tf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: TROFF filter for Printer Type $printerType \c" >/dev/console
- echo "not installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- .vf)
- #
- # They need a Raster Image filter
- #
- dependentFilter=$filterPathName/vf
- if [ ! -x $dependentFilter ]
- then
- echo "NUC: TROFF filter for Printer Type $printerType \c" >/dev/console
- echo "not installed, print request aborted!!" >/dev/console
- exit 2;
- fi
- ;;
-
- *)
- #
- # How did we get called?
- #
- echo "$0: $ifProgramName Unknown print filter" >/dev/console;
- exit 2;
- ;;
- esac
-
- #
- # Set up the PIPE to NetWare printer driver, and push the appropriate dependent
- # filter into the PIPE
- #
- NetWarePrinterDriver="$PRINTJOB_NUCPS -P $printerName $fileArgs \
- -n $userName $ChWidth $ChLength $BANNER"
-
- if [ $dependentFilter = $DEFAULT_FILTER ]
- then
- #
- # Used to push cat(1), but just letting our driver pull from
- # STDIN works just as well, with less overhead.
- #
- $PS_COMMENT_FILTER -P $printerName | $NetWarePrinterDriver
- else
- "$dependentFilter" $argV | $PS_COMMENT_FILTER -P $printerName | $NetWarePrinterDriver
- fi
-
- #
- # Return the status of the printjob_nucps child
- #
- exit $?;
-